package com.onefinger.manager.managers
{
	import com.onefinger.manager.views.model.BaseCRUDModel;
	import com.onefinger.manager.views.model.DeviceCRUDModel;
	import com.onefinger.manager.vos.Device;
	
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	import mx.collections.ArrayCollection;
	
	public class DeviceManager extends BaseManager
	{
		
		//--------------------------------------------------------------------
		//    Public Setters and Getters
		//--------------------------------------------------------------------
		
		//.................devices......................
		private var _devices:ArrayCollection;
		
		[Bindable(event="changeDevices")]	
		public function get devices():ArrayCollection
		{
			return _devices;
		}
		public function setDevices(value:ArrayCollection):void
		{
			_devices = value;
			dispatchEvent( new Event( "changeDevices" ) );
		}
		
		public function addDevice(value:Device):void
		{
			_devices.addItem(value);
			dispatchEvent( new Event( "changeDevices" ) );
		}
		//.................Device......................
		private var _device:Device=new Device();
		
		[Bindable(event="changeDevice")]
		public function get device():Device
		{
			return _device;
		}
		public function setDevice(value:Device):void
		{
			_device = value;
			dispatchEvent( new Event( "changeDevice" ) );
		}
		public function selectDevice(value:Device):void
		{
			_device = value;
			dispatchEvent( new Event( "changeDevice" ) );
		}
	}
}